package com.example.demo.Controller;

import com.example.demo.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

@Controller
@RequestMapping("/th")
public class ThymeleafController {
    @RequestMapping("/index")
    public ModelAndView index(ModelAndView modelAndView){
        User user = new User();
        user.setBirthday(new Date());
        user.setDesc("desc");
        user.setName("thymeleaf");
        user.setUserId(12345);
        modelAndView.setViewName("thymeleaf/index");
        modelAndView.addObject("user",user);
        return modelAndView;
    }
    @RequestMapping("/center")
    public String center(){
        return "thymeleaf/center/center";
    }
}
